<?xml version="1.0" encoding="UTF-8"?>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<ui:composition template="/pages/templates/layout_principal.xhtml">
		<ui:define name="body" width="100%">

	

				<h:form>
				
				<h:panelGrid width="100%">
								
					<h:panelGrid styleClass="titulo">
						<h:outputText styleClass="titulo" value="Lista de Recursos" />
					</h:panelGrid>
				
					
					<br />

					<rich:collapsiblePanel header="Pesquisa" switchType="client">
						<table class="form_tabela">
							<tr>
								<td class="form_label">Nome recurso:</td>
								<td><h:inputText id="nomeRecurso" name="Nome do recurso" value="#{manterRecursoControl.recurso.nomeRecurso}" /> <rich:message
									for="nomeRecurso" /></td>
							</tr>
								<tr>
								<td class="form_label">Cargo:</td>
								<td><h:inputText id="cargo" name="Cargo recurso" value="#{manterRecursoControl.recurso.cargo}" /> <rich:message
									for="nomePessoa" /></td>
							</tr>
						</table>
						<hr />
						<h:panelGrid columns="2" cellpadding="3" styleClass="botoes">
							<h:commandButton action="#{manterRecursoControl.pesquisarRecurso()}"
								value="Pesquisar" styleClass="btn_principal" immediate="false" >
								
								</h:commandButton>
							<h:commandButton
								action="#{manterRecursoControl.iniciarCadastrarRecurso()}"
								value="Incluir Nova" immediate="true">
								<f:setPropertyActionListener target="#{manterRecursoControl.operacao}" value="Incluir" />
							</h:commandButton>
						</h:panelGrid>

					</rich:collapsiblePanel>
					
				</h:panelGrid>
				</h:form>
				<br />
				
				<h:form>

					<rich:dataTable id="listaRecursos" 
						cellpadding="0"
						width="50%" 
						cellspacing="0" 
						rows="5" 
						border="0" 
						var="recurso"
						value="#{manterRecursoControl.listRecurso}"
						rowClasses="odd-row, even-row" 
						styleClass="stable"
						keepSaved="true"
						>
						<rich:column width="100%">
							<f:facet name="header">
								<h:outputText value="Id" />
							</f:facet>
							<h:outputText value="#{recurso.idRecurso}"></h:outputText>
						</rich:column>
						
						<rich:column width="100%">
							<f:facet name="header">
								<h:outputText value="Nome" />
							</f:facet>
							<h:outputText value="#{recurso.nomeRecurso}"></h:outputText>
						</rich:column>
						
							<rich:column width="30%">
							<f:facet name="header">
								<h:outputText value="Cargo" />
							</f:facet>
							<h:outputText value="#{recurso.cargo}"></h:outputText>
						</rich:column>
						
						
						<rich:column style="width: 3%; text-align: center;">
						<f:facet name="header">
							<h:outputText value="Alterar" />
						</f:facet>
						<h:commandLink action="#{manterRecursoControl.iniciarAltarerarRecurso()}">
							<f:setPropertyActionListener target="#{manterRecursoControl.recurso}" value="#{recurso}"/>
							<h:graphicImage library="images" name="pencil.png" title="Editar Requisito" />
					</h:commandLink>
					</rich:column>
					<rich:column style="width: 3%; text-align: center;">
						<f:facet name="header">
							<h:outputText value="Excluir" />
						</f:facet>
						<h:commandLink action="#{manterRecursoControl.iniciarExcluirRecurso()}">
							<f:setPropertyActionListener target="#{manterRecursoControl.recurso}" value="#{recurso}"/>
							<h:graphicImage library="images" name="delete.png" title="Editar Requisito" />
						</h:commandLink>
				
					</rich:column>
						
										
						<f:facet name="footer">
							<rich:dataScroller for="listaRecursos" maxPages="5"
								fastControls="hide" />
						</f:facet>
					</rich:dataTable>

				</h:form>
				<rich:jQuery  selector=".stable tr" event="mouseover"
					query="jQuery(this).addClass('active-row')" />
				<rich:jQuery selector=".stable tr" event="mouseout"
					query="jQuery(this).removeClass('active-row')" />

			<!--		</h:panelGrid>		-->

		</ui:define>
		<rich:jQuery selector=".stable tr:odd" query="addClass('odd-row')" />
		<rich:jQuery selector=".stable tr:even" query="addClass('even-row')" />

	</ui:composition>

</ui:component>